package com.log.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author wjy
 * @create 2022-01-2022/1/28 17:56
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
/*
swagger可以生产接口文档
//1.配置文档信息
2.配置生产规则
* */

    /*docket封装接口文档信息*/
    @Bean
    public Docket getDocket() {

        ApiInfoBuilder apiInfoBuilder = new ApiInfoBuilder();
        apiInfoBuilder.title("物流管理系统").description("王嘉宇").version("v1.0.0")
        .contact(new Contact("王嘉宇","xxx.xx","1157930278@qq.com"));

        ApiInfo apiInfo = apiInfoBuilder.build();


        Docket docket = new Docket(DocumentationType.SWAGGER_2).
                apiInfo(apiInfo).
                select().
                apis(RequestHandlerSelectors.basePackage("com.log.controller"))
                .paths(PathSelectors.any())
                .build();//指定文档风格

        return docket;
    }

}
